<!--  角色管理页-->
<template>
  <ex_super_table_page v-bind="option" class="page-container" ref="SuperTablePage">
  </ex_super_table_page>
</template>

<script>
import superTablePageFunction from '@/mixin/super-table-page-function';
import emitOnFunction from '@/mixin/emit-on-function';
let emitKey = 'srm>supplier_product_insurance'
export default {

  title: 'label_srm_product_insurance_supplier_service',
  mixins: [superTablePageFunction, emitOnFunction(emitKey)],
  components: {},

  data() {
    return {
      option: {
        search: {
          model: [
          {
              label: "label_srm_insurance_supplier",
              key: "supplyId",
              type: "select",
              url: "/srm-api/supplier/SupplierRpc/selectPage.json",
              urlParams: { pageIndex: 1, pageSize: 9999 },
              option: { label: "supplierName", value: "id" }
            },
            {
              label: "label_status",
              key: "status",
              type: "select",
              enum:"IsAvailableStatusEnum"
            }
          ],
        },
        action: [
          {
            label: "label_srm_insurance_add_service", attrs: { icon: "el-icon-plus" },
            auth:'srm_product_insurance_edit',
            click: () => {
              this.$router.push({
                path: '/page/srm/product/srm_insurance_edit', query: { emitKey }
              });
            }
          },
        ],

        table: {
          url: "/fms-api/product/PmsSupplyProductRpc/selectProduct.json?productType=INSURANCE",
          model: [
            { key: 'supplyName', label: 'label_srm_insurance_supplier_name' },
            { key: 'productName', label: 'label_srm_insurance_supplier_product_name' },
            { key: 'apiServiceTypeName', label: 'label_srm_insurance_platform' },
            { key: 'apiServiceName', label: 'label_srm_insurance_api_service' },
            { key: 'status', label: 'label_status', attrs: { formatter: (r, c, v, i) => { return v == 'ENABLE' ? '启用' : '禁用' } } },
            { key: 'remark', label: 'label_remark' },
            { key: 'creator', label: 'label_create_user', },
            { key: 'modifier', label: 'label_srm_insurance_update_user' },
            { key: 'gmtModify', label: 'label_srm_insurance_update_date', attrs: { formatter: (r, c, v, i) => { return this.$dateFormat(v) } } },
            {
              type: 'operate', width: 220, operate: [
                {
                  label: "label_edit",
            auth:'srm_product_insurance_edit',

                  click: (row) => {

                    this.$router.push({
                      path: '/page/srm/product/srm_insurance_edit',
                      query: { id: row.id, emitKey, edit: true }
                    })

                  }
                },
                {
                  label: "label_start_using",
            auth:'srm_product_insurance_disable',

                  type: 'confirm-button', url: '/fms-api/product/PmsSupplyProductRpc/updateStatus.json', message: '确定要启用该记录吗？',
                  if: row => !row.status || row.status == 'DISABLED',
                  params: (row) => { return { id: row.id, status: 'ENABLE' } }, done: ['reload', 'tip']
                },
                {
                  label: "UserStatusEnum__FORBIDDEN",
            auth:'srm_product_insurance_disable',

                  type: 'confirm-button', url: '/fms-api/product/PmsSupplyProductRpc/updateStatus.json', message: '确定要禁用该记录吗？',
                  if: row => row.status == 'ENABLE',
                  params: (row) => { return { id: row.id, status: 'DISABLED' } }, done: ['reload', 'tip']
                }
                // ,
                // {
                //   label: "删除", type: 'confirm-button', url: '/fms-api/product/PmsSupplyProductRpc/removeProduct.json', message: '确定要删除该记录吗？',
                //   params: (row) => { return { id: row.id } }, done: ['reload', 'tip']
                // }

              ]
            }
          ]

        }

      },



    };
  },

  created() {


  },

  destroyed() {
  },


  methods: {

  }
};

</script>
<style></style>
